﻿
        <ol class="breadcrumb">
    <li><a href="/Home.html">Home</a></li>
    <li><a href="/WebApp/WebApi"> Sanelib WebApp</a></li>
    <li class="active">Email Config</li>
</ol>
       
           
            <div id="introduction">
                <h1 class="text-left">ControllerApis</h1>
                <h4>EmailConfig Controller</h4>
            </div>
            <div id="start">
                <h3>Class Inherited : SmartApiController</h3>
                <table class="table-condensed table-striped">
                    <tr>
                        <th>>Constructor Parameters</th>
                    </tr>
                    <tr>
                        <td class="table-bordered">IUserSession</td>
                        <td class="table-bordered">IMappingEngine</td>
                    </tr>
                </table>
                <p>Where, Parameters Local Variable are assigned to a Instance Variable form the <b>base</b> of <a href="SmartApiController.html" class="btn-link">SmartApiController</a></p>
                <ol id="method">
                    <li>
                        <b>Get() :</b> where to Get the Email Configration like the MailHost,Port,User,Password,From,To,Ssl,Tls,etc. from the Sanelib Library
                        <pre><code>
var emailConfig = ConfigProvider.GetEmailConfig();
var response = Mapper.Map&lt;EmailConfig, EmailConfigResponse&gt;(emailConfig);
return Content(response);
</code></pre>
                        <p>
                            Here, the GetEmailConfig() is the get from the <b>EmailConfig</b> and Mapping with the <b>EmailConfigResponse</b>   <br />
                            and the Return The Content of the Response in the <a href="/WebApp/SmartApi" class="btn-link">SmartApiController</a> and create the Response.
                        </p>
                    </li>
                    <li>
                        <b>Put() :</b> Where the Put Configuration with the parameter of <a href="/WebApp/EmailConfig" class="btn-link">EmailConfigForm</a><br />
                        <pre><code>
var response = new WebApiResultResponse();
var config = Mapper.Map&lt;emailconfigform, emailconfig&gt;(form);
ConfigProvider.SetEmailConfig(config, true);
return Content(response.IsSuccess = true);                         
</code></pre>
                        <p>
                            and the Mapping to the <abbr title="Stored in Dto">EmailConfigForm</abbr> and the <abbr title="Stored in Sanelib Library">EmailConfig</abbr>
                            After the Mapping done set the SetEmailConfig from the Sanelib Library in the <abbr title="Sanelib\Services\Impl\ConfigProvider.cs">ConfigProvider</abbr> and return the Content response to the IsSuccess is true
                        </p>
                    </li>
                </ol>
            </div>
        